package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.AlarmRecordMapper;
import com.hello.system.domain.AlarmRecord;
import com.hello.system.service.IAlarmRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 告警记录Service业务层处理
 * 
 * @author hello
 * @date 2025-09-09
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, AlarmRecord> implements IAlarmRecordService 
{
    private final AlarmRecordMapper alarmRecordMapper;

    /**
     * 查询告警记录
     * 
     * @param alarmId 告警记录主键
     * @return 告警记录
     */
    @Override
    public AlarmRecord selectAlarmRecordByAlarmId(Long alarmId)
    {
        return alarmRecordMapper.selectAlarmRecordByAlarmId(alarmId);
    }

    /**
     * 查询告警记录列表
     * 
     * @param alarmRecord 告警记录
     * @return 告警记录
     */
    @Override
    public List<AlarmRecord> selectAlarmRecordList(AlarmRecord alarmRecord)
    {
        return alarmRecordMapper.selectAlarmRecordList(alarmRecord);
    }

    /**
     * 新增告警记录
     * 
     * @param alarmRecord 告警记录
     * @return 结果
     */
    @Override
    public int insertAlarmRecord(AlarmRecord alarmRecord)
    {
        alarmRecord.setCreateTime(DateUtils.getNowDate());
        return alarmRecordMapper.insertAlarmRecord(alarmRecord);
    }

    /**
     * 修改告警记录
     * 
     * @param alarmRecord 告警记录
     * @return 结果
     */
    @Override
    public int updateAlarmRecord(AlarmRecord alarmRecord)
    {
        alarmRecord.setUpdateTime(DateUtils.getNowDate());
        return alarmRecordMapper.updateAlarmRecord(alarmRecord);
    }


    /**
     * 批量删除告警记录
     * 
     * @param alarmIds 需要删除的告警记录主键
     * @return 结果
     */
    @Override
    public int deleteAlarmRecordByAlarmIds(Long[] alarmIds)
    {
        return alarmRecordMapper.deleteAlarmRecordByAlarmIds(alarmIds);
    }

    /**
     * 删除告警记录信息
     * 
     * @param alarmId 告警记录主键
     * @return 结果
     */
    @Override
    public int deleteAlarmRecordByAlarmId(Long alarmId)
    {
        return alarmRecordMapper.deleteAlarmRecordByAlarmId(alarmId);
    }
}
